package com.yjd.bi.market.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import com.yjd.bi.market.dao.IMarketChannelDao;
import com.yjd.bi.market.model.MarketChannelModel;
import com.yjd.bi.market.service.IMarketChannelService;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;

/**
 * <b>description</b>：渠道表业务实现<br>
 * <b>time</b>：2018-07-05 16:29:30 <br>
 * <b>author</b>：  yangchangyan@yijiedai.com
 */
@Service("marketChannelService")
public class MarketChannelServiceImpl extends BaseServiceImpl implements IMarketChannelService {

	/**
	 * 插入
	 *
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public MarketChannelModel insert(MarketChannelModel model) throws Exception {
		return this.marketChannelDao.insertModel(model, true);
	}

	/**
	 * 更新
	 *
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(MarketChannelModel model) throws Exception {
		return this.marketChannelDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int delete(long id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("id", id);
		return this.marketChannelDao.deleteModel(paramMap, true);
	}

	@Resource
	private IMarketChannelDao marketChannelDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.marketChannelDao;
	}

}
